<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" ></meta>
    <title>详细内容</title>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/common.css" type="text/css">
   	<%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
   	<script src="${assets}/bootstrapValidator/js/bootstrapValidator.js"></script>
   	<script src="${assets}/bootstrapValidator/js/language/zh_CN.js"></script>
   	<script>
   	$(document).ready(function() {
   		$('#myForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                role_id: {
                    validators: {
                        notEmpty: true
                    }
                },
                available: {
                    validators: {
                    	notEmpty: true
                    }
                }
            }
        }).on('success.form.bv', function (e) {
            e.preventDefault();
            $.ajax({
                url:'${URL_BASE_UPDATEUSER}',
                type:'post',
                data:$('#myForm').serialize(),
                async : false, //默认为true 异步
                error:function(){
                    alert('error');
                },
                success:function(data){
                	closeFrame();
                }
            });
        });
   	});
   	//关闭并刷新
	function closeFrame(){
		window.parent.closeModal();
	}
   	</script>
</head>
<body style="width: 98%">
<form id="myForm" class="form-horizontal" method="post" >
    <input type="hidden" id="user_id" name="user_id" value="${entity.user_id}" />
    <div class="clearfix">
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">用户名</label>
	        <div class="col-sm-8">
	            <input type="text" id="user_name" name="user_name" class="form-control"  value="${entity.user_name}" readonly="readonly">
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	    	<label class="col-sm-4 control-label">密码</label>
	        <div class="col-sm-8">
	            <input type="text" id="password" name="password" class="form-control" >
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">姓名</label>
	        <div class="col-sm-8">
	            <input type="text" id="real_name" name="real_name" class="form-control" value="${entity.real_name}">
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">所属医院</label>
	        <div class="col-sm-8">
	            <select id="hospId" name="hospId" class="form-control">
	            	<option value="">请选择...</option>
                	<c:forEach items="${hospitalList}" var="hospital">
                    	<option value="${hospital.hospId}" <c:if test="${hospital.hospId==entity.hospId}">selected="selected"</c:if> >${hospital.hospShortName}</option>
                	</c:forEach>
	            </select>
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">科室</label>
	        <div class="col-sm-8">
	            <input type="text" id="dept_name" name="dept_name" class="form-control" value="${entity.dept_name}">
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">用户类型</label>
	        <div class="col-sm-8">
	            <select id="role_id" name="role_id" class="form-control">
	            	<option value="">请选择...</option>
                	<c:forEach items="${roleList}" var="role">
                    	<option value="${role.role_id}" <c:if test="${role.role_id==entity.role_id}">selected="selected"</c:if> >${role.role_name}</option>
                	</c:forEach>
	            </select>
	        </div>
	    </div>
	    <div class="form-group col-sm-6">
	        <label class="col-sm-4 control-label">用户状态</label>
	        <div class="col-sm-8">
	            <select id="available" name="available" class="form-control">
	                <option value="1" <c:if test="${entity.available==1}">selected="selected"</c:if> >启用</option>
	                <option value="0" <c:if test="${entity.available==0}">selected="selected"</c:if> >未启用</option>
	            </select>
	        </div>
	    </div>
	</div>
    <div class="modal-footer" style="text-align: center ">
        <button type="button" class="btn btn-default" data-dismiss="modal" id="closeModalButt" onclick="closeFrame()">关闭</button>
        <button type="submit" class="btn btn-primary">保存</button>
    </div>
</form>
</body>
</html>